package com.msh.frame.client.exception;


import com.msh.frame.client.common.ErrorCode;
import com.msh.frame.client.common.Result;

/**
 * 服务器产生的异常
 */
public class ServerException extends MshRuntimeException {
  private Result result;

  public ServerException(Result result) {
    super(result.getMsg());
    this.result = result;
  }

  public ServerException(String msg) {
    super(msg);
    this.result = Result.errorReturn(ErrorCode.SYSTEM_ERROR.getCode(), msg);
  }

  public static void doThrow(String msg) {
    throw new ServerException(Result.errorReturn(ErrorCode.SYSTEM_ERROR.getCode(), msg));
  }
}
